#include <iostream>

#include "edaExpCoolingSchedule.h"
#include "edaSA.h"
#include "edaGenContinue.h"
#include "edaTimeContinue.h"
#include "loNetList.hpp"
#include "loScriptMove.hpp"
#include "loScriptMoveRandom.hpp"
#include "sisInterface.h"

int main(int argc, char **argv)
{
  //if (argc != 2 )
  //{
  //  std::cerr << "Usage : ./loSASearch [instance]" << std::endl;
  //  return 1;
  //}

  srand(1000);

  sisInit();
  loNetList netlist( argv[1] );

  loScriptMove script;
  loScriptMoveRandom script_random( 0, 5 );
  edaExpCoolingSchedule coolingSchedule(0.001, 0.990);
  edaGenContinue cont_criteria(1);
  //edaTimeContinue cont_criteria(1);

  edaSA saSearch(&script,
  		 &script_random, 
		 &cont_criteria, 
		 1100.0, 
		 &coolingSchedule);

  std::cout << "[From Fitness] " << netlist.fullEvaluate() << std::endl;
  saSearch.search( netlist );
  //void *nl = netlist.getNetlist();
  //sisComExecute( nl, argv[2] );
  std::cout << "[To Fitness] " << netlist.fullEvaluate() << std::endl;
  sisEnd();

  return 0;
}
